
import { mapState } from "vuex";

const mixinUser = {
  computed:{
    ...mapState({
      token: state => state.user.token,
      username: state => state.user.username,
      realname: state => state.user.realname,
      avatar: state => state.user.avatar,
      avatar_fileUrl:state => state.user.avatar_fileUrl,
    })
  }
};

const mixinApp = {
  computed: {
    ...mapState({
      layoutMode: state => state.app.layout,
      navTheme: state => state.app.theme,
      primaryColor: state => state.app.color,
      colorWeak: state => state.app.weak,
      multipage: state => state.app.multipage,//多页签设置
      fixedHeader: state => state.app.fixedHeader,
      fixSiderbar: state => state.app.fixSiderbar,
      contentWidth: state => state.app.contentWidth,// 内容宽度 Fixed：固定, Fluid:流式， 顶部菜单有效
      autoHideHeader: state => state.app.autoHideHeader,
      sidebarOpened: state => state.app.sidebar.opened,
      systemName: state => state.app.systemName,
      systemSimpleName: state => state.app.systemSimpleName,
      systemLogo:state => state.app.systemLogo,
      systemLoginLogo:state=>state.app.systemLoginLogo,
    })
  }
};


const mixinDevice = {
  computed: {
    ...mapState({
      device: state => state.app.device,
    })
  },
  methods: {
    isMobile () {
      return this.device === 'mobile'
    },
    isDesktop () {
      return this.device === 'desktop';
    }
  }
};

export { mixinApp, mixinDevice ,mixinUser}
